<template>
<view>
<view class="top-warp">
  <icon type="search" size="18" class="index_icon"></icon>
  <input class="fr" placeholder="搜索品牌或商品"></input>
</view>
<view v-for="(item, index) in goodsHot" :key="index">
  <view class="popup-warp">
    <view class="popup-pic fl">
      <image :src="item.icon"></image>
    </view>
    <view class="pop-warp fr">
      <view class="pop-title">
        <text>{{item.name}}</text>
      </view>
      <view class="pop-current">
        <text>￥</text>
        <text>{{item.sellingPrice}}</text>
      </view>
      <view class="pop-sell">
        <text>￥</text>
        <text>{{item.marketPrice}}</text>
      </view>
    </view>
  </view>
</view>
</view>
</template>

<script>
// var util = require('../../utils/util.js');
// import request from '../../utils/requestUtils.js';
// import {
//   xcxId,
//   hotGoods_url,
// } from "../../utils/data.js";
var app = getApp();

export default {
  data() {
    return {
      goodsHot: ""
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.hotGoods();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {
    //热门商品列表
    hotGoods: function () {
      var openId = wx.getStorageSync("openid");
      var $this = this;
      var params = {};
      request.POST({
        url: hotGoods_url,
        params: params,
        header: request.postHeader,
        success: function (res) {
          $this.setData({
            goodsHot: res.data.data
          });
        },
        fail: function (res) {//失败后的逻辑
        }
      });
    }
  }
};
</script>
<style>
@import "./goodshot.css";
</style>